Difference Between RPC and RMI (with Comparison Chart) 您所在的位置:网站首页 java rpc rmi Difference Between RPC and RMI (with Comparison Chart)

Difference Between RPC and RMI (with Comparison Chart)

#Difference Between RPC and RMI (with Comparison Chart)| 来源: 网络整理| 查看: 265

RPC vs RMIRPC and RMI are the mechanisms which enable a client to invoke the procedure or method from the server through establishing communication between client and server. The common difference between RPC and RMI is that RPC only supports procedural programming whereas RMI supports object-oriented programming.

Another major difference between the two is that the parameters passed to remote procedures call consist of ordinary data structures. On the other hand, the parameters passed to remote method consist of objects.

Content: RPC Vs RMI Comparison Chart Definition Key Differences Conclusion

Comparison Chart

Basis for comparisonRPCRMI SupportsProcedural programming Object-oriented programming ParametersOrdinary data structures are passed to remote procedures.Objects are passed to remote methods. EfficiencyLower than RMIMore than RPC and supported by modern programming approach (i.e. Object-oriented paradigms) OverheadsMore Less comparatively In-out parameters are mandatory.YesNot necessarily Provision of ease of programming High low Definition of RPC

Remote Procedure Call (RPC) is a programming language feature devised for the distributed computing and based on semantics of local procedure calls. It is the most common forms of remote service and was designed as a way to abstract the procedure call mechanism to use between systems connected through a network. It is similar to IPC mechanism where the operating system allows the processes to manage shared data and deal with an environment where different processes are executing on separate systems and necessarily require message-based communication.

Let’s understand how RPC is implemented through the given steps: The client process calls the client stub with parameters, and its execution is suspended until the call is completed. The parameters are then translated into machine-independent form by marshalling through client stub. Then the message is prepared which contain the representation of the parameters. To find the identity of the site the client stub intercommunicate with name server at which remote procedure exists. Using blocking protocol the client stub sends the message to the site where remote procedure call exists. This step halt the client stub until it gets a reply.RPC mechanism The server site receives the message sent from the client side and converts it into machine specific format. Now server stub executes a call on the server procedure along with the parameters, and the server stub is discontinued till the procedure gets completed. The server procedure returns the generated results to the server stub, and the results get converted into machine-independent format at server stub and create a message containing the results. The result message is sent to the client stub which is converted back into machine specific format suitable for the client stub. At last client, stub returns the results to the client process. Definition of RMI

Remote Method Invocation (RMI) is similar to RPC but is language specific and a feature of java. A thread is permitted to call the method on a remote object. To maintain the transparency on the client and server side, it implements remote object using stubs and skeletons. The stub resides with the client and聽for the remote object it behaves as a proxy.

When a client calls a remote method, the stub for the remote method is called. The client stub is accountable for creating and sending the parcel containing the name of a method and the marshalled parameters, and the skeleton is responsible for receiving the parcel. RMI mechanismThe skeleton unmarshals parameters and invokes the desired method on the server. The skeleton marshals the given value (or exceptions) with the parcel and sends it to client stub. The stub reassembles the return parcel and sends it to the client.

In Java, the parameters are passed to methods and returned in the form of reference. This could be troublesome for RMI service since not all objects are possibly remote methods. So, it must determine which could be passed as reference and which could not.

Java uses process named as serialisation where the objects are passed as value. The remote object is localised by pass by value. It can also pass an object by reference through passing a remote reference to the object along with the URL of the stub class. Pass by reference restricts a stub for the remote object.

Key Differences Between RPC and RMI RPC supports procedural programming paradigms thus is C based, while RMI supports object-oriented programming paradigms and is java based. The parameters passed to remote procedures in RPC are the ordinary data structures. On the contrary, RMI transits objects as a parameter to the remote method. RPC can be considered as the older version of RMI, and it is used in the programming languages that support procedural programming, and it can only use pass by value method. As against, RMI facility is devised based on modern programming approach, which could use pass by value or reference. Another advantage of RMI is that the parameters passed by reference can be changed. RPC protocol generates more overheads than RMI. The parameters passed in RPC must be “in-out” which means that the value passed to the procedure and the output value must have the same datatypes. In contrast, there is no compulsion of passing “in-out” parameters in RMI. In RPC, references could not be probable because the two processes have the distinct address space, but it is possible in case of RMI.

Conclusion

Both RPC and RMI serves the same purpose but are used in languages support different programming paradigms, therefore have distinct features.

Related Differences: Difference Between Call By Value and Call by Reference Difference Between Client-Server and Peer-to-Peer Network Difference Between SMTP and POP3 Difference Between Trigger and Procedure Difference Between ref and out in C#


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有